home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13548 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.monmouth.com!srkumar
  2. From: srkumar@shell.monmouth.com (Senthil Kumar)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: What Should An Exception Handling Do? -- Clarification of rules
  5. Date: 26 Mar 1996 04:08:18 GMT
  6. Organization: Monmouth Internet Corporation
  7. Message-ID: <slrn4lerdj.2be.srkumar@shell.monmouth.com>
  8. References: <1996Mar14.155641.4299@schbbs.mot.com> <4irn11$7ln@mimas.brunel.ac.uk> <Pine.Sola.3.91.960322041345.17711C-100000@ux5.cso.uiuc.edu>
  9. NNTP-Posting-Host: shell.monmouth.com
  10. X-Newsreader: slrn (0.8.3)
  11.  
  12. The way I look at exception handling (so far) is as a means of passing
  13. error messages (which cannot be ignored) from one layer of code to a
  14. higher layer of code, when possible errors cannot be resolved within
  15. the layer that does the throw.
  16.  
  17. For eg. consider a function called fprintf, which takes a FILE *
  18. as its first argument. Now obviously, fprintf cannot do a damn thing
  19. with a NULL FILE *, and thus in this case it would be a good idea to
  20. throw an exception, telling the caller, "look, you better check this out."
  21.  
  22. Am I on the right track? I would appreciate some comments, additional
  23. refinements etc.
  24.  
  25. thanks,
  26. Senthil
  27.  
  28.